<?php
namespace app\mobile\controller;

use app\model\Theme; 
use app\model\Worker; 

class WSetother extends Base
{
    public function W_setother()
    {
global $_G, $_P;
$fans = $this->checkuser();
$themeid = intval($_P['themeid']);
if($themeid < 0){
	return_msg('管理后台地址不正确');
}
$system=$_G['system'];
$theme = Theme::getThemeById($themeid);
$config = 	Theme::getConfig($themeid);
if(empty($theme['id'])){
	return_msg('管理后台地址不正确');
}
$myworker = Worker::getThemeWorkerByOpenidNew($_G['openid'],$themeid);
if(!($system['ruanjian']!=3 || $config['showshop']==0 || ($system['ruanjian']==3 && $config['showshop']==$myworker['company']))){
	$myworker = "";
}
if (empty($myworker)) {
	return_msg('您不是员工,无权访问');
}
$msg = Worker::gethoutaistats();
if (!empty($msg)) {
	return_msg($msg);
}
$do = 'order';
$op = !empty($_P['op']) ? $_P['op'] : 'display';
$id = intval($_P['id']);

if ($op=='display') {
}elseif ($op=='save'){

	$data = array (
		'blacklist'       => $_P['blacklist'],
	);
    Theme::update($themeid,$data);

	$theme_old = array(
		'blacklist'       => $theme ['blacklist'],
	);
	writelog($id,'手机编辑',$theme_old,$data,$myworker['username']);
    $config_old = $config;

    $config['isworkerpay'] = intval($_P['isworkerpay']);
    $config['ishexiao'] = intval($_P['ishexiao']);
    $config['homeshowshop'] = intval($_P['homeshowshop']);
    $config['tuanrank'] = intval($_P['tuanrank']);
    $config['fansrank'] = intval($_P['fansrank']);
    $config['sharetitle1'] = empty($_P['sharetitle1'])?$config['sharetitle1']:$_P['sharetitle1'];
    $config['sharetitle2'] = empty($_P['sharetitle2'])?$config['sharetitle2']:$_P['sharetitle2'];
    $config['sharetitlexcx'] = empty($_P['sharetitlexcx'])?$config['sharetitlexcx']:$_P['sharetitlexcx'];
    $config['sharetitlexcx2'] = empty($_P['sharetitlexcx2'])?$config['sharetitlexcx2']:$_P['sharetitlexcx2'];
    $config['isshowkefu'] = intval($_P['isshowkefu']);
    $config['istime'] = intval($_P['istime']);
    $config['iswttouxiang'] = intval($_P['iswttouxiang']);
    $config['isshowname'] = intval($_P['isshowname']);
    $config['showpayresult'] = intval($_P['showpayresult']);
    $config['isdanmu'] = intval($_P['isdanmu']);
    $config['danmu01'] = intval($_P['danmu01']);
    $config['danmu02'] = intval($_P['danmu02']);
    $config['danmu03'] = intval($_P['danmu03']);
    $config['danmu04'] = intval($_P['danmu04']);


	writelog($id,'手机编辑',$config_old,$config,$myworker['username']);
	Theme::setConfig($config,$themeid,$_G['mpid']);
    return_msg('保存成功','','success');
}
    
if($_G['companyname'] =='新飞驰软件'){
	$return_clicent = get_defined_vars();
return view('/fcworker/fc_setother' , $return_clicent);
}else{
	$return_clicent = get_defined_vars();
return view('/yxworker/w_setother' , $return_clicent);
}
}
}